package com.scalar.forecast.forecastReports.actions;

import com.scalar.forecast.ForecastAction;
import com.scalar.forecast.forecastReports.dao.ForecastReportsDAO;
import com.scalar.chiptrack.sales.dao.CustomerDAO;
import com.scalar.chiptrack.sales.dao.NewSalesOrderDAO;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Action class for processing the request related to project report screen
 *
 * Created by Veeru. 
 * Date: Jul 22, 2005
 * Time: 5:20:59 PM 
 */

public class ProjectsReportAction extends ForecastAction {

    public ActionForward execute ( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response ) throws Exception
    {
        try
        {
            request.setAttribute( "customerSelectList", CustomerDAO.getAllCustomers() );
            request.setAttribute( "salesRepList", NewSalesOrderDAO.loadSalesPersons() );
            //request.setAttribute( "endUserList", NewCustomerDAO.loadOdms() );
            request.setAttribute( "endUserList",  ForecastReportsDAO.getAllCustomers( null ) );
            request.setAttribute( "productsList", ForecastReportsDAO.getAllProducts( null ) );
        }
        catch(Exception e)
        {
          e.printStackTrace();
        }
        return( mapping.findForward( "projectsReport" ) );
    }
}
